﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WpfApplication2
{
    public class percentItem : INotifyPropertyChanged
    {
        private string name;
        private long size;
        private int percent;
        public percentItem(string name, int size, int percent)
        {
            this.name = name; this.size = size; this.percent = percent;
        }
        public string Name
        {
            get{return this.name;}
            set { this.name = value; NotifyChanged("Name"); }
        }
        public long Size
        {
            get { return this.size; }
            set { this.size = value; NotifyChanged("Size"); }
        }
        public int Percent
        {
            get { return this.percent; }
            set { this.percent = value; NotifyChanged("Percent"); }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyChanged(string propertyName)
        {
            if(PropertyChanged!=null){
                PropertyChanged(this,new PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [ValueConversion(typeof(long),typeof(string))]
    public class DataConverter:IValueConverter
    {
        public object Convert(object value,Type targetType,object parameter,CultureInfo culture)
        {
            long size=(long)value;
            return size.ToString();
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string size = (string)value;
            return long.Parse(size);
        }

    }
    
}
